﻿using System;

using MosCraft.Utilities;

namespace MosCraft.Blocks
{
    public class BlockFlower : Block
    {
        public BlockFlower(int id, int UV)
            :base(id, UV, Material.Plants)
        {
            float offset = 0.2F;
            setBlockBounds(0.5F - offset, 0.0F, 0.5F - offset, 0.5F + offset, offset * 3F, 0.5F + offset);
        }

        public override bool canPlaceBlockAt(World world, int x, int y, int z)
        {
            return base.canPlaceBlockAt(world, x, y, z) && canThisPlantGrowOnThisBlockID(world.getBlockID(x, y - 1, z));
        }

        protected bool canThisPlantGrowOnThisBlockID(int id)
        {
            return id == Block.Grass.blockID || id == Block.Dirt.blockID;
        }

        public override bool canBlockStay(World world, int x, int y, int z)
        {
            return (world.canBlockSeeTheSky(x, y, z)) && canThisPlantGrowOnThisBlockID(world.getBlockID(x, y - 1, z));
        }

        public override AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
        {
            return null;
        }

        public override bool RenderOpposites()
        {
            return true;
        }

        public override bool isOpaqueCube()
        {
            return false;
        }

        internal override bool renderAsNormalBlock()
        {
            return false;
        }

        public override RenderMode getRenderType()
        {
            return RenderMode.CROSS;
        }
    }
}
